package com.kkb.service.impl;

import com.kkb.mapper.AdminsMapper;
import com.kkb.pojo.Admins;
import com.kkb.pojo.AdminsExample;
import com.kkb.service.AdminService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {

    @Resource
    private AdminsMapper adminsMapper;

    @Override
    public boolean isMatch(String adminName, String adminPwd) {
        AdminsExample adminsExample = new AdminsExample();
        AdminsExample.Criteria criteria = adminsExample.createCriteria();
        criteria.andLoginNameEqualTo(adminName).andAdminPwdEqualTo(adminPwd);
        List<Admins> admins = adminsMapper.selectByExample(adminsExample);
        System.out.println("====================================");
        admins.stream().forEach(c-> System.out.println(c.getLoginName()));
        System.out.println("====================================");
        return admins.size()>0;
    }

}
